#include <material_editor/createnewshaderdialog.h>

CreateNewShaderDialog::CreateNewShaderDialog(QWidget *parent)
  : QDialog(parent)
{
  _gui.setupUi(this);

  connect (_gui.pushButtonOk, SIGNAL(clicked()), this, SLOT(accept()));
  connect (_gui.pushButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
}




void CreateNewShaderDialog::SetName(const QString &name)
{
  _gui.lineEditName->setText (name);
}

QString CreateNewShaderDialog::GetName() const
{
  return _gui.lineEditName->text();
}

void CreateNewShaderDialog::SetCategory(const Category &category)
{
  Category c = category;
  _catgoryBaseName = c.GetBaseName();
  c.PopFront();

  _gui.lineEditCategory->setText (c.GetFullName());
  _gui.lineEditCategory->setFocus();
  _gui.lineEditCategory->selectAll ();
}


Category CreateNewShaderDialog::GetCategory() const
{
  Category cat (_catgoryBaseName);
  cat.Add(_gui.lineEditCategory->text ());
  return cat;
}

void CreateNewShaderDialog::SetShaderType(ceShaderType type)
{
  _gui.comboBoxShaderType->setCurrentIndex((int)type);
}

ceShaderType CreateNewShaderDialog::GetShaderType() const
{
  return (ceShaderType)_gui.comboBoxShaderType->currentIndex();
}

